﻿<Window x:Class="CECB.Email.Email_Reader_New_Window"
       	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"
        mc:Ignorable="d"
        xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing"
        
        xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
   
	
        Title="EmailReader_Window" Height="992" Width="1377" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" WindowState="Maximized" WindowStyle="None">
    <Window.Background>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="#FF878684" Offset="0" />
            <GradientStop Color="White" Offset="1" />
        </LinearGradientBrush>
    </Window.Background>

    <Window.Resources>

        <!--===================== Canvas Animations ===============-->

        <Storyboard x:Key="SlideCanvasRL">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="canvas">
                <EasingDoubleKeyFrame KeyTime="0:0:0.7" Value="4050.625">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CircleEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="canvas">
                <EasingDoubleKeyFrame KeyTime="0:0:0.7" Value="253.102">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CircleEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>

        <!--================================================================-->


        <!--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->

        <SolidColorBrush x:Key="ListBorder" Color="Black"/>
        <Style x:Key="ListBoxStyle1" TargetType="{x:Type ListBox}">
            <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
            <Setter Property="BorderBrush" Value="{StaticResource ListBorder}"/>
            <Setter Property="BorderThickness" Value="0"/>
            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
            <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
            <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
            <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
            <Setter Property="ScrollViewer.PanningMode" Value="Both"/>
            <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ListBox}">
                        <Grid>
                            <Rectangle Fill="Pink" RadiusX="10" RadiusY="10" Opacity="0.195" />
                            <Border CornerRadius="10" x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="1" SnapsToDevicePixels="true">
                                <ScrollViewer Focusable="false" Padding="{TemplateBinding Padding}" Template="{DynamicResource ScrollViewerControlTemplate1}">
                                    <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                </ScrollViewer>
                            </Border>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                            </Trigger>
                            <Trigger Property="IsGrouping" Value="true">
                                <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <ControlTemplate x:Key="ScrollViewerControlTemplate1" TargetType="{x:Type ScrollViewer}">
            <Grid x:Name="Grid" Background="{TemplateBinding Background}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>

                <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" />
                <ScrollBar x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}" Style="{DynamicResource ScrollBarStyle1}"/>
            </Grid>
        </ControlTemplate>
        <LinearGradientBrush x:Key="VerticalScrollBarBackground" EndPoint="1,0" StartPoint="0,0">
            <GradientStop Color="#E1E1E1" Offset="0"/>
            <GradientStop Color="#EDEDED" Offset="0.20"/>
            <GradientStop Color="#EDEDED" Offset="0.80"/>
            <GradientStop Color="#E3E3E3" Offset="1"/>
        </LinearGradientBrush>
        <SolidColorBrush x:Key="ScrollBarDisabledBackground" Color="#F4F4F4"/>

        <Style x:Key="ScrollBarButton" TargetType="{x:Type RepeatButton}">
            <Setter Property="OverridesDefaultStyle" Value="true"/>
            <Setter Property="Focusable" Value="false"/>
            <Setter Property="IsTabStop" Value="false"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type RepeatButton}">
                        <Microsoft_Windows_Themes:ScrollChrome x:Name="Chrome" RenderMouseOver="{TemplateBinding IsMouseOver}" RenderPressed="{TemplateBinding IsPressed}" SnapsToDevicePixels="true" Microsoft_Windows_Themes:ScrollChrome.ScrollGlyph="{TemplateBinding Microsoft_Windows_Themes:ScrollChrome.ScrollGlyph}"/>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="VerticalScrollBarPageButton" TargetType="{x:Type RepeatButton}">
            <Setter Property="OverridesDefaultStyle" Value="true"/>
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="Focusable" Value="false"/>
            <Setter Property="IsTabStop" Value="false"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type RepeatButton}">
                        <Rectangle Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"/>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}">
            <Setter Property="OverridesDefaultStyle" Value="true"/>
            <Setter Property="IsTabStop" Value="false"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Thumb}">
                        <Rectangle   Width="8" Fill="White" RadiusX="5" RadiusY="5">
                            <Rectangle.Effect>
                                <DropShadowEffect ShadowDepth="0" BlurRadius="10" Color="White" />
                            </Rectangle.Effect>
                        </Rectangle>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <LinearGradientBrush x:Key="HorizontalScrollBarBackground" EndPoint="0,1" StartPoint="0,0">
            <GradientStop Color="#E1E1E1" Offset="0"/>
            <GradientStop Color="#EDEDED" Offset="0.20"/>
            <GradientStop Color="#EDEDED" Offset="0.80"/>
            <GradientStop Color="#E3E3E3" Offset="1"/>
        </LinearGradientBrush>
        <Style x:Key="HorizontalScrollBarPageButton" TargetType="{x:Type RepeatButton}">
            <Setter Property="OverridesDefaultStyle" Value="true"/>
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="Focusable" Value="false"/>
            <Setter Property="IsTabStop" Value="false"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type RepeatButton}">
                        <Rectangle Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"/>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="ScrollBarStyle1" TargetType="{x:Type ScrollBar}">
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
            <Setter Property="Stylus.IsFlicksEnabled" Value="false"/>
            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
            <Setter Property="Width" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
            <Setter Property="MinWidth" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>

            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ScrollBar}">
                        <Grid x:Name="Bg" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
                            <Border Width="1" Background="#FFFFFF" HorizontalAlignment="Center"/>
                            <Track x:Name="PART_Track" IsDirectionReversed="true" IsEnabled="{TemplateBinding IsMouseOver}">

                                <Track.Thumb>
                                    <Thumb Style="{StaticResource ScrollBarThumb}" Microsoft_Windows_Themes:ScrollChrome.ScrollGlyph="VerticalGripper"/>
                                </Track.Thumb>
                            </Track>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter Property="Background" TargetName="Bg" Value="{StaticResource ScrollBarDisabledBackground}"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <Trigger Property="Orientation" Value="Horizontal">
                    <Setter Property="Width" Value="Auto"/>
                    <Setter Property="MinWidth" Value="0"/>
                    <Setter Property="Height" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>
                    <Setter Property="MinHeight" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>
                    <Setter Property="Background" Value="{StaticResource HorizontalScrollBarBackground}"/>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type ScrollBar}">
                                <Grid x:Name="Bg" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition MaxWidth="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}"/>
                                        <ColumnDefinition Width="0.00001*"/>
                                        <ColumnDefinition MaxWidth="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}"/>
                                    </Grid.ColumnDefinitions>
                                    <RepeatButton Command="{x:Static ScrollBar.LineLeftCommand}" IsEnabled="{TemplateBinding IsMouseOver}" Style="{StaticResource ScrollBarButton}" Microsoft_Windows_Themes:ScrollChrome.ScrollGlyph="LeftArrow"/>
                                    <Track x:Name="PART_Track" Grid.Column="1" IsEnabled="{TemplateBinding IsMouseOver}">
                                        <Track.DecreaseRepeatButton>
                                            <RepeatButton Command="{x:Static ScrollBar.PageLeftCommand}" Style="{StaticResource HorizontalScrollBarPageButton}"/>
                                        </Track.DecreaseRepeatButton>
                                        <Track.IncreaseRepeatButton>
                                            <RepeatButton Command="{x:Static ScrollBar.PageRightCommand}" Style="{StaticResource HorizontalScrollBarPageButton}"/>
                                        </Track.IncreaseRepeatButton>
                                        <Track.Thumb>
                                            <Thumb Style="{StaticResource ScrollBarThumb}" Microsoft_Windows_Themes:ScrollChrome.ScrollGlyph="HorizontalGripper"/>
                                        </Track.Thumb>
                                    </Track>
                                    <RepeatButton Grid.Column="2" Command="{x:Static ScrollBar.LineRightCommand}" IsEnabled="{TemplateBinding IsMouseOver}" Style="{StaticResource ScrollBarButton}" Microsoft_Windows_Themes:ScrollChrome.ScrollGlyph="RightArrow"/>
                                </Grid>
                                <ControlTemplate.Triggers>
                                    <Trigger Property="IsEnabled" Value="false">
                                        <Setter Property="Background" TargetName="Bg" Value="{StaticResource ScrollBarDisabledBackground}"/>
                                    </Trigger>
                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Trigger>
            </Style.Triggers>
        </Style>
        <Style TargetType="{x:Type ListBoxItem}">
            <Setter Property="Foreground" Value="White" />
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
            <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
            <Setter Property="Padding" Value="2,0,0,0"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ListBoxItem}">
                        <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
                            <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsSelected" Value="true">
                                <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
                                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
                            </Trigger>
                            <MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="IsSelected" Value="true"/>
                                    <Condition Property="Selector.IsSelectionActive" Value="false"/>
                                </MultiTrigger.Conditions>
                                <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
                            </MultiTrigger>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>



    </Window.Resources>




    <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Hidden">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="200" />
                <ColumnDefinition Width="300" />
                <ColumnDefinition Width="860" />

            </Grid.ColumnDefinitions>

            <!--<Expander Header="expander1" Name="expander1" Grid.Column="2" Margin="0,0,0,47" Grid.ColumnSpan="2">
            <WebBrowser Height="850" Name="webBrowser1" Width="877" />
        </Expander>-->
            <WrapPanel Grid.Column="0" Orientation="Vertical" Background="#FF554E4E" OpacityMask="{x:Null}">
                <Label Content="Connection Status" Foreground="White" Height="30" Background="Red" HorizontalAlignment="Left"  FontSize="12"  Width="200" Name="labelInternetConnectionStatus" />
                <StackPanel Margin="0,100,0,0">
                    <Button  Background="#FF3E3832" BorderBrush="{x:Null}" Click="RefreshMailBox_Click" Height="70" Cursor="Hand" Name="RefreshMailButton" Width="200">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="35" />
                                <RowDefinition Height="15" />
                                <RowDefinition Height="15" />
                            </Grid.RowDefinitions>

                            <StackPanel Grid.Row="0">
                                <TextBlock HorizontalAlignment="Center"  Height="30" Text="Refresh Mail Box" FontSize="20" Foreground="White" Width="154" Background="{x:Null}" />
                            </StackPanel>
                            <StackPanel Grid.Row="1" >
                                <ProgressBar Visibility="Hidden" Height="10" VerticalAlignment="Top" Name="progressBarRefresh" Width="190"/>
                            </StackPanel>
                            <StackPanel Grid.Row="2">
                                <TextBlock Visibility="Hidden"  Name="textBloackAllMailCountProgress" Text="Pro" HorizontalAlignment="Center" Height="15"   FontSize="12" Foreground="White" TextWrapping="NoWrap" />
                            </StackPanel>
                        </Grid>
                    </Button>
                </StackPanel>

                <StackPanel>
                    <Button  Background="#FF3E3832" BorderBrush="{x:Null}" Click="NewMailButton_Click" Height="70"  Cursor="Hand" Name="NewMailButton" Width="200">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="35" />
                                <RowDefinition Height="15" />
                                <RowDefinition Height="15" />
                            </Grid.RowDefinitions>

                            <StackPanel Grid.Row="0" Orientation="Horizontal" Width="200">
                                <TextBlock Margin="30,0,0,0" Height="30" HorizontalAlignment="Right"  Text="New Emails" FontSize="20" Foreground="White"    />
                                <TextBlock  Name="TextBlockNewMailNotify" Text=" " Width="30" TextAlignment="Center"  Margin="10,0,0,0"  FontSize="20" Foreground="White" Background="Red"   />
                            </StackPanel>
                            <StackPanel Grid.Row="1">
                                <ProgressBar Height="10" Name="progressBarNewMail" Width="190" />
                            </StackPanel>
                            <StackPanel Grid.Row="2">
                                <TextBlock Name="textBloackNewMailCountProgress" Text="Pro" HorizontalAlignment="Center" Height="15"   FontSize="12" Foreground="White" TextWrapping="NoWrap" />
                            </StackPanel>
                        </Grid>
                    </Button>
                </StackPanel>



                <StackPanel>
                    <Button Background="#FF3E3832" BorderBrush="{x:Null}" Click="AllMailButton_Click" Height="50" Cursor="Hand"  Name="AllMailButton" Width="200">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="30" />
                                <RowDefinition Height="15" />
                            </Grid.RowDefinitions>

                            <StackPanel Grid.Row="0">
                                <TextBlock HorizontalAlignment="Center"  Text="All Emails" FontSize="20" Foreground="White" TextWrapping="NoWrap" />
                            </StackPanel>
                            <StackPanel Grid.Row="1">
                                <TextBlock Name="textBloackAllMailCount" Text="120" HorizontalAlignment="Center"    FontSize="12" Foreground="White" TextWrapping="NoWrap" />
                            </StackPanel>

                        </Grid>
                    </Button>
                </StackPanel>



            </WrapPanel>


            <StackPanel Grid.Column="1" Width="300" Orientation="Vertical" Background="#FF797070" OpacityMask="{x:Null}">


                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="50" />
                        <RowDefinition Height="700" />
                    </Grid.RowDefinitions>

                    <StackPanel Grid.Row="0">
                        <TextBlock Text="View Emails By Project: " Foreground="White" FontSize="12"></TextBlock>
                        <toolkit:AutoCompleteBox Name="ProjectAutocompleteTextBox"  Width="300"  Margin="0, 0,0,0" Height="35"  ValueMemberPath="proj_name"  FilterMode="Contains"  ItemsSource="{Binding}"  TabIndex="1" IsTabStop="True"  SelectionChanged="ReferenceTextBox_SelectionChanged" FontSize="18"   Opacity="1" HorizontalAlignment="Center" UseLayoutRounding="False" BorderBrush="WhiteSmoke" BorderThickness="2" Background="#FFB7BAA3">
                            <toolkit:AutoCompleteBox.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal"  >
                                        <TextBlock Text="{Binding Path=proj_reference}"/>
                                        <TextBlock Text=" - "/>
                                        <TextBlock Text="{Binding Path=proj_name}"/>
                                    </StackPanel>
                                </DataTemplate>
                            </toolkit:AutoCompleteBox.ItemTemplate>
                        </toolkit:AutoCompleteBox>
                    </StackPanel>


                    <ListBox x:Name="listBoxNewEmails" Grid.Row="1" Width="300" Margin="0, 0,0,0" ScrollViewer.CanContentScroll="False" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto"   Style="{DynamicResource ListBoxStyle1}"    Background="DimGray"    SelectionChanged="listBoxAllEmails_SelectionChanged">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <WrapPanel Background="#FF3E3832" MaxWidth="300">
                                    <StackPanel Orientation="Horizontal" MaxWidth="300">
                                        <!--<CheckBox IsChecked="{Binding Deleteable, Mode=TwoWay}" Name="CheckBoxActivity" VerticalAlignment="Center" HorizontalAlignment="Left"  />-->
                                        <WrapPanel Orientation="Vertical" MaxWidth="300">
                                            <StackPanel Height="35" Background="#FF3E3832">
                                                <Label Content="{Binding MessageSubject}" Height="35" Width="300" Foreground="White" Padding="10,0,0,0"   HorizontalAlignment="Left" FontSize="20" />
                                            </StackPanel>

                                            <StackPanel Height="20" Background="#FF342424" Margin="0,-2,0,0">
                                                <Label Content="{Binding MessageDate}" Height="20" Width="300" Foreground="White" Padding="10,0,0,0"    HorizontalAlignment="Left" FontSize="12" />
                                            </StackPanel>
                                        </WrapPanel>
                                    </StackPanel>
                                </WrapPanel>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>

                    <ListBox Visibility="Hidden" x:Name="listBoxAllEmails" Grid.Row="1" Width="300" Margin="0, 0,0,0" ScrollViewer.CanContentScroll="False" ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Visible"   Style="{DynamicResource ListBoxStyle1}"    Background="Aqua" SelectionChanged="listBoxAllEmails_SelectionChanged" >
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <WrapPanel Background="#FF3E3832" MaxWidth="300">
                                    <StackPanel Orientation="Horizontal" MaxWidth="300">
                                        <!--<CheckBox IsChecked="{Binding Deleteable, Mode=TwoWay}" Name="CheckBoxActivity" VerticalAlignment="Center" HorizontalAlignment="Left"  />-->
                                        <WrapPanel Orientation="Vertical" MaxWidth="300">

                                            <StackPanel Height="35" Background="#FF3E3832">
                                                <Label Content="{Binding MessageSubject}" Height="35" Width="300" Foreground="White" Padding="10,0,0,0"   HorizontalAlignment="Left" FontSize="20" />
                                            </StackPanel>

                                            <StackPanel Height="20" Background="#FF342424" Margin="0,-2,0,0">
                                                <Label Content="{Binding MessageDate}" Height="20" Width="300" Foreground="White" Padding="10,0,0,0"    HorizontalAlignment="Left" FontSize="12" />
                                            </StackPanel>
                                        </WrapPanel>
                                    </StackPanel>
                                </WrapPanel>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>



                </Grid>





            </StackPanel>

            <WrapPanel Grid.Column="2" Orientation="Vertical" Grid.ColumnSpan="2">

                <Canvas x:Name="canvas"   Width="auto" Height="auto" RenderTransformOrigin="0.5,0.5">
                    <Canvas.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform/>
                            <SkewTransform/>
                            <RotateTransform/>
                            <TranslateTransform/>
                        </TransformGroup>
                    </Canvas.RenderTransform>

                    <!--====== Controlers ========-->


                    <Grid>
                        <WrapPanel Orientation="Vertical">
                            <WrapPanel Height="50" Width="860"  HorizontalAlignment="Left" Background="WhiteSmoke" Orientation="Horizontal">
                                <Label Content="Header : " Height="42" Name="labelMailHeader" FontSize="18" Width="680"/>
                                <StackPanel   Width="auto" Orientation="Horizontal" Margin=" 0,0,0,0">

                                    <Grid Margin="140,0,0,0" HorizontalAlignment="Right" VerticalAlignment="Top">
                                        <Image Height="32" Margin="2" Source="/CECB;component/images/closeblack.png"  Width="32" MouseLeftButtonDown="Image_MouseLeftButtonDown" />
                                    </Grid>
                                </StackPanel>
                            </WrapPanel>

                            <Expander Name="ExpanderComments" Header="Comments By :" Background="#FF797070" FontSize="18" Foreground="White">
                                <Grid Height="auto" Width="850">
                                    <TextBox Height="500" Name="TextBoxBody" Text="" Padding="20,20,0,0"  Margin="0,0,0,0" FontSize="16" Cursor="IBeam"  >
                                        <TextBox.Background>
                                            <ImageBrush ImageSource="/CECB;component/images/notebookback1.jpg" Stretch="Fill" TileMode="None" />
                                        </TextBox.Background>
                                    </TextBox>
                                </Grid>
                            </Expander>

                            <WrapPanel Height="auto" Width="860" Orientation="Vertical" Background="{x:Null}">

                                <StackPanel Orientation="Horizontal" Height="50" Background="#FF989796">
                                    <Label Content="Attachments " Margin="0,-10,0,0" Height="45" Name="label2" FontSize="28" />
                                    <Label Height="42" Margin="300,0,0,0" FontSize="16" Name="textBox1" Width="300" Foreground="White" BorderBrush="White" BorderThickness="3" />
                                    <Image Height="49" Name="image1" Stretch="Fill" Width="66" Source="/CECB;component/images/attch.png" MouseLeftButtonUp="image1_MouseLeftButtonUp" ImageFailed="image1_ImageFailed" />
                                </StackPanel>
                                <StackPanel  Orientation="Horizontal">
                                    <Button Content="Preview" Height="50" Margin="590,0,0,0" Name="ConfrirmDetails"  Width="125" Click="ConfrirmDetails_Click" />
                                    <Button Content="Confirm" Height="50" Margin="0,0,0,0" Name="FilerDetails"  Width="125" Click="FilerDetails_Click" />
                                </StackPanel>
                                <StackPanel Height="625">
                                    <Canvas   >

                                        <ListBox x:Name="listBoxEmailValues" HorizontalAlignment="Left" ScrollViewer.CanContentScroll="False" ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.HorizontalScrollBarVisibility="Hidden" SelectionChanged="listBoxActivities_SelectionChanged" Height="577" Background="AliceBlue" Width="853" BorderThickness="0"  >
                                            <ListBox.ItemTemplate>
                                                <DataTemplate>
                                                    <WrapPanel  Margin="25,0,0,0" Orientation="Vertical" Background="#A83E3832" Width="750" Height="110">
                                                        <StackPanel Orientation="Vertical" Width="700">
                                                            <StackPanel Orientation="Horizontal">
                                                                <Label Content="Activity : " Height="30" Width="100" Foreground="White"    HorizontalAlignment="Left" FontSize="16" />
                                                                <Label Content="{Binding Actv_reference}" Height="30" Width="auto" Foreground="White"    HorizontalAlignment="Left" FontSize="16" />
                                                            </StackPanel>
                                                            <StackPanel Orientation="Horizontal">
                                                                <Label Content="Impact : " Height="30" Width="100" Foreground="White"    HorizontalAlignment="Left" FontSize="16" />
                                                                <Label Content="{Binding Impt_reference}" Height="30" Width="auto" Foreground="White"   HorizontalAlignment="Left" FontSize="16" />
                                                            </StackPanel>
                                                        </StackPanel>
                                                        <StackPanel Background="#FF989796" Width="700" Orientation="Horizontal" Margin="110,0,0,0">
                                                            <Label Content="Importence : " Height="35" Width="auto" Foreground="White"    HorizontalAlignment="Left" FontSize="15" />
                                                            <TextBox Name="tbxMag" TextChanged="tbxMag_TextChanged" Text="{Binding Mtrx_magnitude}" Height="40" Margin="0,0,0,0" FontSize="18" Width="70" TextAlignment="Center" Foreground="Red"   HorizontalAlignment="Right"   />
                                                            <Label Content="Magnitude : " Height="35" Width="auto" Foreground="White"    HorizontalAlignment="Left" FontSize="15" />
                                                            <TextBox Name="tbxImp" TextChanged="tbxImp_TextChanged" Text="{Binding Mtrx_importance}" Height="40" Margin="10,0,0,0" Width="70" FontSize="18" Foreground="Red"  TextAlignment="Center"  HorizontalAlignment="Right"   />
                                                            <Button Content="Confirm" Height="40" Name="ConfirmButton" Background="Red" Margin="10,0,0,0" Width="100" Click="button1_Click" />
                                                        </StackPanel>
                                                    </WrapPanel>
                                                </DataTemplate>
                                            </ListBox.ItemTemplate>
                                        </ListBox>


                                        <ListBox x:Name="SimpleMatrixlistBoxEmailValues" HorizontalAlignment="Left" ScrollViewer.CanContentScroll="False" ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.HorizontalScrollBarVisibility="Hidden" SelectionChanged="listBoxActivities_SelectionChanged" Height="577" Background="DimGray" Width="853" BorderThickness="0" Canvas.Left="-1">
                                            <ListBox.ItemTemplate>
                                                <DataTemplate>
                                                    <WrapPanel  Margin="25,0,0,0" Orientation="Vertical" Background="#A83E3832" Width="750" Height="110">
                                                        <StackPanel Orientation="Vertical" Width="700">
                                                            <StackPanel Orientation="Horizontal">
                                                                <Label Content="Activity : " Height="30" Width="100" Foreground="White"    HorizontalAlignment="Left" FontSize="16" />
                                                                <Label Content="{Binding Actv_reference}" Height="30" Width="auto" Foreground="White"    HorizontalAlignment="Left" FontSize="16" />
                                                            </StackPanel>
                                                            <StackPanel Orientation="Horizontal">
                                                                <Label Content="Impact : " Height="30" Width="100" Foreground="White"    HorizontalAlignment="Left" FontSize="16" />
                                                                <Label Content="{Binding Impt_reference}" Height="30" Width="auto" Foreground="White"   HorizontalAlignment="Left" FontSize="16" />
                                                            </StackPanel>
                                                        </StackPanel>
                                                        <StackPanel Background="#FF989796" Width="700" Orientation="Horizontal" Margin="110,0,0,0">
                                                            <Label Content="Importence : " Height="35" Width="auto" Foreground="White"    HorizontalAlignment="Left" FontSize="15" />

                                                            <TextBox Text="{Binding Mtrx_value}" Height="40" Margin="10,0,0,0" Width="70" FontSize="18" Foreground="Red"  TextAlignment="Center"  HorizontalAlignment="Right"   />
                                                            <Button Content="Confirm" Height="40" Name="ConfirmButton" Background="#FFB7BAA3" Margin="10,0,0,0" Width="100" Click="ConfirmButton_Click" />
                                                        </StackPanel>
                                                    </WrapPanel>
                                                </DataTemplate>
                                            </ListBox.ItemTemplate>
                                        </ListBox>


                                    </Canvas>
                                </StackPanel>

                            </WrapPanel>
                        </WrapPanel>
                    </Grid>



                </Canvas>

            </WrapPanel>
        </Grid>
    </ScrollViewer>
</Window>
